FROM golang:1.23.4 AS builder

ENV GO111MODULE=on \
    GOPROXY=https://goproxy.cn,direct

RUN mkdir /app
# 设置工作目录
WORKDIR /app

# 复制所有文件到容器中
COPY . .

# 下载并安装依赖包
RUN go mod tidy

# 编译 Go 程序
RUN go build -o gina


FROM golang:1.23.4
WORKDIR /app
COPY --from=builder . /app/


# 声明服务端口
EXPOSE 8888

# 启动 Go 应用
CMD ["./gina"]

